package hw048901.lesson1;

import java.util.ArrayList;

public class Tprints<T> {
private  ArrayList<T> t1;
public ArrayList<T> getT1() {
	return t1;
}
public void setT1(ArrayList<T> t1) {
	this.t1 = t1;
}
 
public Tprints(){}
public Tprints(ArrayList<T> tin){
	this.t1 = tin;
}

  
public void printPtList(ArrayList<T> ptList,int i1) {
		{
			int j;
			try {
				for (j = 0; j < i1 - 1; j++) {
					System.out.print(ptList.get(j).toString().concat("  "));
				}
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}

public boolean BreakT(T o1)
{
	   boolean isBreak=false;
	   int j;
	   try
	   {
	    for (j=0;j<t1.size()-1;j++)
	    {
		    	if (o1.equals(t1.get(j))) 
		    	{
		    		isBreak = true;
		    		break;
		    	}
		    }
	    
	   } 
	   catch(Exception e)
	   {
		   e.printStackTrace();
		  
	   }
	   return isBreak;  
}
 
public static  void main(String[] args)
	{
		boolean ib;
		int i,j;
		ArrayList<Integer> a = new ArrayList();
		j=100;
		for (i=1;i<=j;i++)
		{
			a.add(i);
		}
		// method 2
		Tprints<Integer> pt=new Tprints<Integer>();
		pt.setT1(a);
		pt.printPtList(pt.getT1(),100);
		System.out.println("");
		ib = pt.BreakT(new Integer(47));

		if(ib)
		{
			System.out.println("find the objecdt 10 break success!");
		}
		else
		{
			System.out.println("not find the objecdt 10 break failed!");
		}
		
	}
}
